package cn.itcast.travel.web.servlet.collection;

import cn.itcast.travel.service.CollectionService;
import cn.itcast.travel.service.impl.CollectionServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "Addcollention", value = "/Addcollention")
public class Addcollention extends HttpServlet {
    CollectionService service=new CollectionServiceImpl();
    //加入收藏和取消收藏
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String bgid=request.getParameter("bgid");
        String bloggerid=request.getParameter("bloggerid");
        ObjectMapper ob=new ObjectMapper();
        service.addcollec(bgid,bloggerid);
        ob.writeValue(response.getWriter(),1);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
